<form method="post" action="/sys/page/config/edit" enctype="multipart/form-data" class="pageForm required-validate"
      onsubmit="return iframeCallback(this, pageRefresh)">
    <input type="hidden" id="pageCode" name="pageCode" th:value="${pageCode}">
    <input type="hidden" id="fields" name="fields" value="">
    <input type="hidden" id="randomData" name="randomData" value="">
    <div class="ibox no-margins no-padding no-borders">
        <div class="ibox-title p-xs ljFixBoxTitle">
            <div class="btn btn-sm btn-primary pull-right" id="btnEditSubmit"><i class="fa fa-paste">提交保存</i></div>
        </div>
        <div style="height:40px;"></div>
        <div class="ibox-content">
            <div class="row">
                <div class="form-group col-md-4">
                    <label>系统编号:</label>
                    <input type="text" class="form-control input-sm" th:value="${sysSystem.systemCode}" readonly>
                </div>
                <div class="form-group col-md-4">
                    <label>页面编号:</label>
                    <input type="text" class="form-control input-sm" th:value="${pageCode}" readonly>
                </div>
            </div>
            <div class="row p-lr-sm">
                <div class="panel panel-info ">
                    <div class="panel-heading">页面字段</div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="form-group col-md-12">
                                <div th:each="item,status:${fieldArray}" class=" i-checks pull-left m-r-md"
                                     style="width:180px;height:25px;overflow:hidden;">
                                    <label><input type="checkbox" class="fieldItemName" th:checked="${fieldsConfig[item]=='1'}"
                                                  th:value="${item}">&nbsp;&nbsp;[[${item}]]</label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<script>
    jQuery(function ($) {
        $(".chosen-select").chosen();
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
        $("#btnEditSubmit").on("click", function () {
            var values = {};
            modifyVerf(values);
            var fields = '';
            $(".fieldItemName").each(function () {
                if ($(this).is(':checked')) {
                    if (fields === '') {
                        fields = fields + $(this).val() + "_1";
                    } else {
                        fields = fields + "," + $(this).val() + "_1";
                    }
                } else {
                    if (fields === '') {
                        fields = fields + $(this).val() + "_0";
                    } else {
                        fields = fields + "," + $(this).val() + "_0";
                    }
                }
            });
            $("#fields").val(fields);
            $("#cmd5").val(values.cmd5);
            $("#uid").val(values.uid);
            $("#randomData").val(values.randomData);
            $(this).closest("form").submit();
        });
    });
</script>